home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / DebugTool_111.lha / srcalphabet.c < prev    next >
C/C++ Source or Header  |  1993-05-06  |  2KB  |  98 lines

  1. #include "frobnitz.h"
  2.  
  3. const char default_alphabet[3][26] =
  4. {
  5.   {
  6.     'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
  7.     'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
  8.   },
  9.   {
  10.     'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
  11.     'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
  12.   },
  13.   {
  14.     '\0' /* ASCII literal */ , '\n',
  15.     '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  16.     '.', ',', '!', '?', '_', '#', '\'', '\"', '/', '\\', '-', ':', '(', ')'
  17.   }
  18. };
  19.  
  20. /*******************************************************************/
  21. /*  Funktion: ReadAlphabet                                         */
  22. /*******************************************************************/
  23.  
  24. void
  25. ReadAlphabet (void)
  26. {
  27.   short int table, elem;
  28.  
  29.   if (header.alfabet_offset)
  30.     {
  31.       seek_pos (header.alfabet_offset);
  32.       fread (alphabet, 1, 3 * 26, DatFile);
  33.       alphabet[2][0] = '\0';
  34.       alphabet[2][1] = '\n';
  35.     }
  36.   else
  37.     {
  38.       for (table = 0; table < 3; table++)
  39.     for (elem = 0; elem < 26; elem++)
  40.       alphabet[table][elem] = default_alphabet[table][elem];
  41.     }
  42.   alph_read = 1;
  43. }
  44.  
  45. /*******************************************************************/
  46. /*  Funktion: PrintAlphabet                                        */
  47. /*******************************************************************/
  48.  
  49. void
  50. PrintAlphabet (void)
  51. {
  52.   short int table, elem;
  53.   char c;
  54.  
  55.   printf ("ALPHABET:\n\n");
  56.  
  57.   printf ("\tA1\tA2\tA3\n");
  58.   printf ("\
  59. 0\t[Space]\t[Space]\t[Space]\n\
  60. 1\t[M1->]\t[M1->]\t[M1->]\n\
  61. 2\t[M2->]\t[M2->]\t[M2->]\n\
  62. 3\t[M3->]\t[M3->]\t[M3->]\n\
  63. 4\t[A2->]\t[A2->]\t[A1->]\n\
  64. 5\t[A3->]\t[A1->]\t[A3->]\n\
  65. ");
  66.  
  67.   for (elem = 0; elem < 26; elem++)
  68.     {
  69.       printf ("%d\t", elem + 6);
  70.       for (table = 0; table < 3; table++)
  71.     {
  72.       c = alphabet[table][elem];
  73.       switch (c)
  74.         {
  75.         case '\0':
  76.           printf ("[ASCII->->]\t");
  77.           break;
  78.         case '\n':
  79.           printf ("[Return]\t");
  80.           break;
  81.         case 11:
  82.           printf ("[VTab]\t");
  83.           break;
  84.         case '\t':
  85.           printf ("[HTab]\t");
  86.           break;
  87.         case ' ':
  88.           printf ("[Space]\t");
  89.           break;
  90.         default:
  91.           printf ("%c\t", c);
  92.         }
  93.     }
  94.       newline ();
  95.     }
  96.   printf ("(Type: %s)\n", (header.alfabet_offset ? "special" : "default"));
  97. }
  98.